#pragma once
#include <Windows.h>
#include<map>
using namespace std;
#include "focusView.h"
class KeyboardInfo;
typedef pair<HANDLE,KeyboardInfo> KeyboardMapEntry;
class KeyboardInfo
{
public:
	HANDLE handle;
	HWND window;


	KeyboardInfo(){}
	KeyboardInfo(HANDLE _handle,HWND _window):handle(_handle),window(_window){}
	KeyboardMapEntry GetMapEntry()
	{
		return KeyboardMapEntry(handle,*this);
	}
	
};
typedef map<HANDLE,KeyboardInfo> KeyboardMap;


class MultiKeyboardHandler
{
	SINGLETON(MultiKeyboardHandler);
public:
	HHOOK m_hGMHook ;
	HHOOK m_hCBTHook ;
	CFocusView* m_view;
	KeyboardMap m_keyboards;
	~MultiKeyboardHandler(void);
	void CaptureDevices(HWND);
	LRESULT HandleInput(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam);
	bool HookWindows(HINSTANCE);
	static LRESULT CALLBACK LowLevelKeyboardProc(int nCode,WPARAM wParam,LPARAM lParam);
	void ActivateWindow(HWND hwnd);
	void SendKeyboardMessage(KeyboardInfo& keyinfo,RAWKEYBOARD& keydata);	


};
